require "skynet.manager"
local skynet = require "skynet"
-- local pbc = require "pbc_helper"
-- local config = require "configquery"
-- local setting = require "setting"
local Command = require "zhajinhua.Command"
local Message = require "zhajinhua.Message"
local Objects = require "Objects"



math.randomseed(tostring(os.time()):reverse():sub(1, 6))

g_objects = Objects.new()

---------------------------------------------------------
-- LUA Command
---------------------------------------------------------
-- local CMD = {}
-- local robot_services = {}
-- local robot_number = 1


function init()	
	-- local name = skynet.getenv("robot_name")
	-- print("#############机器人###########"..name)
	-- local svr_config = setting[name]	
	-- skynet.newservice("debug_console",svr_config.debug_port)
	-- local service
	-- local playerid
	-- --初始化机器人服务
	-- for robot_id = 1, robot_number do
	-- 	service = skynet.newservice('robot_service')
	-- 	playerid = 10000000+robot_id
	-- 	skynet.call(service, 'lua', 'start',skynet.self(), svr_config.ip, svr_config.port, robot_type, robot_id,playerid)
	-- 	skynet.sleep(500)
	-- end
	-- skynet.call(service, 'lua', 'start',skynet.self(), svr_config.ip, svr_config.port, robot_type, robot_id,10000033)

	
	local message = Message.new()
	local command = Command.new(message)
	g_objects:add(message)
	g_objects:add(command)
	g_objects:hotfix('zhajinhua')
	skynet.dispatch("lua", message:dispatch())
end

skynet.start(function()
	init()
	skynet.register('niuniu')
end)